<?php require_once LAYOUTPATH.'layout_header.php'; ?>

<?php require_once FLASHPARTIAL; ?>

MEMCACHED VERSION

<div id="bricabox_header">
	<h1><img class="profile_avatar" src="<?php echo url_for_avatar($mem_user->avatar, $mem_user->id, 'user', 'large'); ?>" alt="<?php echo $mem_user->login; ?>" width="100" height="100" />
		<?php echo username($mem_user); ?></h1>
</div>

<div id="content_header">
	<div class="left">
		<h2><?php echo auto_typography(ascii_to_entities(auto_link($mem_user->bio, 'both', true))); ?>&nbsp;</h2>
	</div>
	<div class="right">
		<ul class="user_stats">
			<?php if ($this->userland->logged_in()): ?>
			<?php if ($mem_user->login != $user->login): ?>
			<!--<li class="follow"><a href="#">Follow <?php echo username($mem_user); ?></a></li>-->
			<?php else: ?>
			<li class="you"><span>This is you! <a href="/account/edit">Edit your account</a></span></li>
			<?php endif; ?>
			<?php endif; ?>
			<li class="member">Member since <?php echo date('m/d/Y', strtotime($mem_user->created_at)); ?></li>
			
			<?php if ($this->userland->logged_in() && $this->userland->current_user()->is_admin): ?>
			<a href="mailto:<?php echo $mem_user->email; ?>">Email</a>
			<?php endif; ?>
		</ul>
	</div>
</div>

<div id="blocks">
	<div class="column" id="blocks_large">
		<div class="comments">
			<?php require APPPATH.'views/account/_new_comment.php'; ?>
			
			<?php
			$COMMENT_USERS = array();
			if ($comments->num_rows()):
				foreach ($comments->result() as $comment):
			?>
			<?php require APPPATH.'views/account/_comment_mc.php'; ?>
			<?php
				endforeach;
			endif;
			?>
		</div>
	</div>
	
	<div class="column" id="blocks_small">
		<div class="other_bricaboxes">
			<h2>My BricaBoxes</h2>
			<ul>
			<?php
			$query = $this->db->query('select subdomain,name,use_custom_domain,custom_domain from bricaboxes where user_id = ? and privacy > 0', array($mem_user->id));
			if ($query->num_rows()):
				foreach ($query->result() as $member_of):
			?>
				<li><a href="<?php echo bricabox_url($member_of); ?>"><?php echo $member_of->name; ?></a></li>
			<?php
				endforeach;
			endif;
			?>
			</ul>
		
			<h2>I'm a member of&hellip;</h2>
			<ul>
			<?php
			$query = $this->db->query('select subdomain,name,use_custom_domain,custom_domain from bricaboxes where privacy > 0 and id in (select bricabox_id from memberships where user_id = ? and role_id < 5)', array($mem_user->id));
			if ($query->num_rows()):
				foreach ($query->result() as $member_of):
			?>
				<li><a href="<?php echo bricabox_url($member_of); ?>"><?php echo $member_of->name; ?></a></li>
			<?php
				endforeach;
			endif;
			?>
			</ul>
		</div>
	</div>
</div>

<?php require_once LAYOUTPATH.'layout_footer.php'; ?>